package day07;

public class Person {
    String name;
    int age;
    String address;
    Person(){}
    void eat(){}
    void sleep(){}
    void sayHi(){
        System.out.println("my name is "+name+",my age is "+age+",i am from "+address);
    }
    Person(String name,int age,String address){
        this.address=address;
        this.name=name;
        this.age=age;
    }
}
class Student extends Person{
    String className;
    int stuId;
    Student(String name,int age,String address,String className,int stuId){
        super(name, age, address);
        this.className=className;
        this.stuId=stuId;
    }
    void study(){
        System.out.println(name+"正在学习");
    }
    void sayHi(){
        System.out.println("my name is "+name+",my age is "+age+",i am from "+address+",my ID is "+stuId+"i am in "+className);
    }

}
class Teacher extends Person{
    int salary;
    Teacher(String name,int age,String address,int salary){
        super(name, age, address);
        this.salary=salary;
    }
    void teach(){
        System.out.println("正在教"+salary);
    }
    void sayHi(){
        System.out.println("my name is " + name + ", my age is " + age + ", I am from " + address + ", my salary is " + salary);
    }
}
class Doctor extends Person{
    String title;
    Doctor(String name,int age,String address,String title){
        super(name, age, address);
        this.title=title;
    }
    void cut(){
        System.out.println(age+"岁的"+name+"正在做"+title+"手术");
    }
}
 class Test{
    public static void main(String[] args){
        Student student = new Student("aaa",18,"浙江","三班",123546);
        student.sayHi();
        student.study();

        Teacher teacher = new Teacher("bbb",30,"北京",5000);
        teacher.sayHi();
        teacher.teach();

        Doctor doctor = new Doctor("ccc",40,"四川","外科");
        doctor.sayHi();
        doctor.cut();

    }
}
